package com.xiaoyu.lanling.feature.coin.data

import com.xiaoyu.base.net.RequestCreator
import com.xiaoyu.lanling.common.config.HttpConfig
import com.xiaoyu.lanling.event.coin.*

object CoinData {

    const val PRODUCT_ID_COIN_THOUSAND = "product_id_coin_thousand"
    const val PRODUCT_ID_COIN_THIRTY = "product_id_coin_thirty"

    fun myPoint(requestTag: Any) {
        RequestCreator.create<CoinIncomeEvent>(requestTag, CoinIncomeEvent::class.java)
                .setRequestUrl(HttpConfig.COIN_MY_POINT)
                .enqueue()
    }

    fun accost(requestTag: Any, uid: String) {
        RequestCreator.create<CoinAccostEvent>(requestTag, CoinAccostEvent::class.java)
                .setRequestUrl(HttpConfig.IM_ACCOST)
                .addQueryData("to", uid)
                .enqueue()
    }

    fun exchangeProductList(requestTag: Any) {
        RequestCreator.create<CoinExchangeListEvent>(requestTag, CoinExchangeListEvent::class.java)
                .setRequestUrl(HttpConfig.LANLING_PRODUCT_LIST)
                .enqueue()
    }

    fun productDetail(requestTag: Any, productId: String) {
        RequestCreator.create<CoinExchangeDetailEvent>(requestTag, CoinExchangeDetailEvent::class.java)
                .setRequestUrl(HttpConfig.LANLING_PRODUCT_DETAIL)
                .addQueryData("id", productId)
                .enqueue()
    }

    fun productConfirm(requestTag: Any, type: String, productId: String, account: String, name: String) {
        RequestCreator.create<CoinProductConfirmEvent>(requestTag, CoinProductConfirmEvent::class.java)
                .setRequestUrl(HttpConfig.LANLING_PRODUCT_CONFIRM)
                .addQueryData("productId", productId)
                .addQueryData("type", type)
                .addQueryData("alipayAccount", account)
                .addQueryData("realName", name)
                .enqueue()
    }

    fun getUserPayAccount(requestTag: Any) {
        RequestCreator.create<CoinPayAccountEvent>(requestTag, CoinPayAccountEvent::class.java)
                .setRequestUrl(HttpConfig.LANLING_USER_PAY_ACCOUNT)
                .enqueue()
    }

    fun getRechargeProductList(requestTag: Any, from: String) {
        RequestCreator.create<CoinRechargeProductListEvent>(requestTag, CoinRechargeProductListEvent::class.java)
                .setRequestUrl(HttpConfig.LANLING_GET_RECHARGE_PRODUCT_LIST)
                .addQueryData("from", from)
                .enqueue()
    }
}